 /*-----------------------------------------------File Info------------------------------------------------
** File Name:               mainTask.h  
** Last modified date:      20220415
** Last version:            V0.1
** Description:                
**--------------------------------------------------------------------------------------------------------*/
#ifndef _MAIN_TASK_H_
#define _MAIN_TASK_H_
#include "userConfig.h"

//#define DBG_CLOSE				0
//#define DBG_ERR				1
//#define DBG_DBG				2
#define MAIN_DBG_LEVEL	DBG_DBG

#if MAIN_DBG_LEVEL == DBG_DBG
	#define MAIN_DBG	GLOBAL_DBG
	#define MAIN_ERR	GLOBAL_ERR	
#elif MAIN_DBG_LEVEL == DBG_ERR
	#define MAIN_ERR	GLOBAL_ERR
#else
	#define MAIN_DBG(...)	
	#define MAIN_ERR(...)	
#endif


#define CHECK_DOOR_STATUS_TIME				60000u			/* 重复检查门状态时间 1分钟  1MIN*60SEC*1000MS*/
#define REPEAT_ALARM_DOOR_OPEN_TIME			60u				/* 门常开重复报警时间 60分钟 */		


enum E_USER_TASK_MSG
{
	MAIN_KEY_MSG,
	MAIN_I2C_MSG,
	MAIN_MODULE_UART0_RECEIVE_DATA,
	MAIN_WDT_HOST_MSG,
	MAIN_GET_ADC_MSG,
};

typedef enum enumUpdateSta
{
	APROM_NONE_UPDATE = 0,	//AP正常状态
	LDROM_NONE_UPDATE,		//LD正常状态
	LDROM_UIPDATEING,		//LD升级状态
}teUpdateSta;


typedef struct	/* 为了升级做兼容,需要保证结构体成员顺序和类型不能变. */
{
	uint8_t 	userMark;					//FLASH初始化标识
	uint8_t		reserv11;					//保留
	uint8_t		reserv12;					//保留
	uint8_t		reserv13;					//保留
	
	uint8_t 	apromVerArch;				//APROM程序架构版本号
	uint8_t 	apromVerSoft;				//APROM程序版本号
	uint8_t 	apromVerModify;				//APROM程序修订版本号
	uint8_t 	identifier;					//AP程序渠道号
	
	teUpdateSta apromUpdateSta;				//标识升级状态
}tsUserData;


extern uint8_t gMainTaskId;
extern tsUserData *gptUserData;

extern void mainTask(uint8_t taskId, uint8_t msg, void *pData, uint16_t dataSize);
extern void getUserData(void);
#if DEFAULT_IDLE_TASK == 0
	extern void idleTask(uint8_t taskId,uint8_t msg, void *pData, uint16_t dataSize);
#endif

#endif /* _MAIN_TASK_H_ */





